﻿using Entity.WMS.DTO.WarehousePurchase;
using Entity.WMS.DTO.WarehouseSale;
using Microsoft.AspNetCore.Mvc;
using Service.WMS;

namespace WebApi.Controllers.WMS
{
    [Route("api/[controller]")]
    [ApiController]
    public class WarehousePurchaseController : ControllerBase
    {
        private readonly WarehousePurchaseService _warehousePurchaseService;

        // 构造函数注入
        public WarehousePurchaseController(WarehousePurchaseService warehousePurchaseService)
        {
            _warehousePurchaseService = warehousePurchaseService;
        }

        /// <summary>
        /// 获取采购入库单列表
        /// </summary>
        /// <param name="warehousePurchaseSearchDTO"></param>
        [HttpGet]
        public async Task<IActionResult> GetWarehousePurchaseList([FromQuery] WarehousePurchaseSearchDTO warehousePurchaseSearchDTO)
        {
            var response = await _warehousePurchaseService.GetWarehousePurchaseList(warehousePurchaseSearchDTO);
            return StatusCode(response.Status, response);
        }

        /// <summary>
        /// 入库
        /// </summary>
        [HttpPost("Rk")]
        public async Task<IActionResult> Rk(string Id)
        {
            var response = await _warehousePurchaseService.Rk(Id);
            return StatusCode(response.Status, response);
        }
    }
}
